<?php
/**
 * Created By PhpStorm
 * Author: patrick wu
 * Date: 2020/10/21
 * Time: 9:57
 */
namespace App\Http\Model\Mysql;

use Illuminate\Database\Eloquent\Model;

class OrderRefundModel extends Model
{
    const IS_DELETE     =   1,      //已删除
        NOT_DELETE      =   0;      //未删除

    const ONLY_RETURN   =   1,      //仅退货
        ONLY_REFUND     =   2,      //仅退款
        ONLY_REFUSE     =   3;      //退款退货

    const AGREE_WAIT    =   0,      //操作 未处理
        AGREE_APPROVAL  =   1,      //操作 已同意
        AGREE_REJECT    =   2;      //操作 拒绝

    const STATUS_HOLD   =   0,      //待处理
        STATUS_REFUND   =   1,      //同意退款
        STATUS_RETURN   =   2,      //同意退货
        STATUS_REJECT   =   3;      //拒绝退换货

    protected $table    =   'mini_order_refund';

    protected $guarded  =   [];

    protected $dateFormat   =   'U';

    /**
     * 退款详情的记录
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function detail()
    {
        return $this->hasOne(OrderProductModel::class, 'id', 'detail_id');
    }

    /**
     * 售后订单进度
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function process()
    {
        return $this->hasMany(OrderRefundProcessModel::class, 'refund_id', 'id');
    }

}
